package com.example.lijuan.myapplication.Client;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by xiaodong on 15/2/24.
 */
public class LocationData implements Parcelable{
    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public float getSpeed() {
        return speed;
    }

    public void setSpeed(float speed) {
        this.speed = speed;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public double latitude = 0;
    public double longitude = 0;
    public float speed = 0;
    public int errorCode = 0;
    public String errorMsg = "";

    public static final Creator<LocationData> CREATOR = new Creator<LocationData>() {
        @Override
        public LocationData createFromParcel(Parcel source) {
            return new LocationData(source);
        }

        @Override
        public LocationData[] newArray(int size) {
            return new LocationData[0];
        }
    };

    public LocationData(){

    }

    LocationData(Parcel source){
        latitude = source.readDouble();
        longitude = source.readDouble();
        speed = source.readFloat();
        errorCode = source.readInt();
        errorMsg = source.readString();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeDouble(latitude);
        dest.writeDouble(longitude);
        dest.writeFloat(speed);
        dest.writeInt(errorCode);
        dest.writeString(errorMsg);
    }
}
